sub
Returns a sublist of this list starting from the specified index (inclusive).
Equivalent to list.sub(index, list.size())
.
Note that:
my_list.sub(my_list.size() - 1)
returns a list containing only the last element ofmy_list
(assumingmy_list.size > 0
)my_list.sub(my_list.size())
returns an empty listmy_list.sub(my_list.size() + 1)
throws an exception
Since
0.6.0
Parameters
the starting index of the sublist (inclusive)
Throws
if the start
index greater than this list's size
Returns a sublist of this list starting from the specified start index (inclusive) to the specified end index (exclusive).
For the list my_list
, my_list.sub(start, my_list.size())
is equivalent to my_list.sub(start)
.
Since
0.6.0
Parameters
the start index of the sublist (inclusive)
the end index of the sublist (exclusive)
Throws
when:
the
start
orend
indexes are greater than this list's sizethe
start
index is greater than theend
index